#ifndef _STRING_H_
#define _STRING_H_

#ifndef NULL
#define NULL ((void *) 0)
#endif

#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t;
#endif

static inline int strncmp(const char *cs, const char *ct, int count)
{
    char *base = (char *)cs;
    for (; cs - base < count && *cs == *ct; cs++, ct++)
        if (!*cs)
            return 0;
    return cs - base == count ? 0 : (*cs - *ct);
}

static inline int strlen(const char *s)
{
    char *p = (char *) s;
    while (*s++);
    return s - p;
}

static inline void *memset(void *s, int c, unsigned int count)
{
    __asm__("cld\n\t"
        "rep\n\t"
        "stosb"
        ::"a" (c),"D" (s),"c" (count)
    );
    return s;
}   

#endif
